//
//  TenderAPI.swift
//  ZYA
//
//  Created by 邱仙凯 on 2024/10/18.
//  Copyright © 2024 zwb. All rights reserved.
//

import UIKit
import Moya

public enum TenderAPI {
   
    //s_data_source： 0/竞拍领导 1/竞拍跟踪
    // zb_source：单据来源(0:竞拍   1:招标)
    case queryBidRecordList(zb_id:String,staff_id:String,zb_source:String,s_data_source:String,sUrid:String)

    // 投标记录  followTag 是否跟踪记录
    case queryTbInfoList(page:String,size:String,z_zb_id:String,z_title:String,followTag:String)
    
    case queryZbInfoList(z_begin_dt:String,z_end_dt:String,z_city:String,z_price_min:String,z_price_max:String,page:String,size:String,z_title:String,z_sort:String,query_type:String,z_status:String,followTag:String,s_data_source:String)
}

extension TenderAPI: TargetType {
    
    public var headers: [String : String]? {
      
            return getBaseInfoDic()
        
        
        
        
    }
    
    public var baseURL: URL {
       
            return URL(string: HTTPStr)!
         
    }
    
    
    public var path: String {
        switch self {
      
        case .queryZbInfoList:
            return "/LeadeQueryControl/queryZbInfoList"
        case .queryTbInfoList:
            return "LeadeQueryControl/queryTbInfoList"
        case .queryBidRecordList:
            return "/LeadeQueryControl/queryBidRecordList"
        }
        
        // MARK: -  path  尾部
    }
    
    public var method: Moya.Method {
        
            return .post
        
        
        
    }
    public var task: Task {
        
        switch self {
       
        default:
            let rrr = testXXX(self)
             let ooo =  Mirror(reflecting: self)
            if let ddd = rrr as? [String:Any] {
                let dic = ddd[ooo.children.first?.label ?? ""]! as! [String : Any]
                return .requestParameters(parameters: dic, encoding: URLEncoding.default)
            } else {
                return .requestPlain
            }

        }
        // MARK: -  参数  尾部
    }
    
    public var sampleData: Data {
        return "{}".data(using: String.Encoding.utf8)!
    }
    
    
}
